package cn.cmkj.auction.ui

import android.content.Intent
import android.os.Bundle
import android.view.View
import android.widget.ImageButton
import android.widget.RelativeLayout
import android.widget.TextView
import cn.cmkj.auction.R
import cn.cmkj.auction.app.BaseActivity
import org.xutils.view.annotation.ContentView
import org.xutils.x

/**
 * Created by cunguoyao on 2018/3/22.
 */
@ContentView(R.layout.activity_about_us)
class AboutUs : BaseActivity(), View.OnClickListener {

    private lateinit var titleBack : ImageButton
    private lateinit var titleText : TextView
    private lateinit var layoutAboutUsA : RelativeLayout
    private lateinit var layoutAboutUsB : RelativeLayout
    private lateinit var layoutAboutUsC : RelativeLayout

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        x.view().inject(this)
        titleBack = findViewById(R.id.title_back) as ImageButton
        titleText = findViewById(R.id.title_text) as TextView
        layoutAboutUsA = findViewById(R.id.layout_about_us_a) as RelativeLayout
        layoutAboutUsB = findViewById(R.id.layout_about_us_b) as RelativeLayout
        layoutAboutUsC = findViewById(R.id.layout_about_us_c) as RelativeLayout

        titleText.text = "关于我们"
        titleBack.setOnClickListener(this)
        layoutAboutUsA.setOnClickListener(this)
        layoutAboutUsB.setOnClickListener(this)
        layoutAboutUsC.setOnClickListener(this)
    }

    override fun onClick(v: View?) {
        when (v?.id) {
            R.id.title_back ->
                finish()
            R.id.layout_about_us_a -> {
                var intent = Intent()
                intent.setClass(this, AboutUsSub::class.java)
                intent.putExtra("sub", 1)
                startActivity(intent) }
            R.id.layout_about_us_b -> {
                var intent = Intent()
                intent.setClass(this, AboutUsSub::class.java)
                intent.putExtra("sub", 2)
                startActivity(intent) }
            R.id.layout_about_us_c -> {
                var intent = Intent()
                intent.setClass(this, AboutUsSub::class.java)
                intent.putExtra("sub", 3)
                startActivity(intent) }
        }
    }
}